// input
// ['foo.txt', '.bar', '' , 'baz.foo' ]
// output
// ['~/cool_app/foo.txt', '~.cool_app/.bar', '~/cool_app/baz.foo']

const files = ['foo.txt', '.bar', 'baz.foo']

// loop
function forLoops() {
  const result = []
  for (const file of files) {
    const fileName = file.trim()
    if(fileName) {
      const filePath = `~.cool_app/${fileName}`
      result.push(filePath)
    }
  }
}


// reduce
function reduceWay() {
  const filePath = files.reduce((result, file) => {
    const fileName = file.trim()
    if(fileName) {
      const filePath = `~.cool_app/${fileName}`
      result.push(filePath)
    }
    return result
  }, [])
}


function chain() {
  const filePaths = files.map((f) => f.trim()).filter(Boolean).map((fileName) => `~cool_app/${fileName}`)
}